package lab01;

import java.util.Scanner;

/**
 * Created by 李晓容 on 2017/10/9.
 */
public class Test12 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a;
        int b;
        int c;
        int units;
        int ten;
        int hundred;
        int thousand;

        System.out.println("请输入任意数字：1-9999");
        a=sc.nextInt();

        units=a%10;
        ten=a/10%10;
        hundred=a/100%10;
        thousand=a/1000%10;

        if (thousand != 0) {
            b=4;
            c=1000*units+100*ten+10*hundred+thousand;
        }else if (ten!=0){
            b=3;
            c=100*units+10*ten+hundred;
        }else if (ten!=0){
            b=2;
            c=10*units+ten;
        }else{
            b=1;
            c=units;
        }
        if (a==c){
            System.out.println("这是"+b+"位数，"+"而且这是回文数");
        }else
            System.out.println("这是"+b+"位数，"+"而且这不是回文数");
    }
}
